export const reduceFun = (arr) => {
	return arr.reduce((acc, curr) => {
		curr.forEach((num, index) => {
			acc[index] = (acc[index] || 0) + parseInt(num);
		});
		return acc;
	}, [])
}

export const totalFun = (arr) => {
	const result = arr[0][0].map((_, index) => {
		let sum = parseInt(arr[0][0][index]);
		for (let i = 1; i < arr.length; i++) {
			sum += parseInt(arr[i][0][index]);
		}
		return sum;
	})
	return result
}


export const discrepancyFun = (arr) => {
	const result = [];
	for (let i = 0; i < arr.length; i++) {
		let diff = 0;
		for (let j = 0; j < arr.length; j++) {
			if (i !== j) {
				diff += arr[j] - arr[i];
			}
		}
		result.push(diff);
	}
	return result
}

export const checkObjectValues = (obj) => {
	for (let key in obj) {
		if (obj[key] > 13) {
			return true;
		}
	}
	return false;
}

export const isLengthGreaterThanValueFun = (arr, select) => {
	const isLengthGreaterThanValue = select.every((subArr, index) => {
		console.log(subArr,index)
	  if (arr[index] !== undefined) {
	    return subArr.length <= Number(arr[index]);
	  }
	  return false;
	});
	return isLengthGreaterThanValue
}